#ifndef __GLCANVAS_H__
#define __GLCANVAS_H__

#include <wx/wx.h>
#include <GL/gl.h>
#include <vector>
#include "wx/glcanvas.h"
#include "../src/scene.h"


class GLCanvas : public wxGLCanvas{
    public:
        GLCanvas(wxFrame* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style = wxSUNKEN_BORDER, const wxString& name = wxT("GLCanvas"));
        ~GLCanvas();

        void setHighligtOption(unsigned int);
        void setWireframeOption(bool);
        void setControlPointsOption(bool);

        Scene scene;

    private:
        void OnPaint(wxPaintEvent&);
        void OnEraseBackground(wxEraseEvent&);
        void OnResize(wxSizeEvent&);
        void OnMouse(wxMouseEvent&);
        void OnKeyDown(wxKeyEvent&);
        void OnEnterWindow(wxMouseEvent&);

        void InitGL();
        void ResetProjectionMode();
        void Render();
        void drawFloor();
        void drawLight();
        void drawAxis();

        void setXRotation(int);
        void setYRotation(int);
        void setZRotation(int);
        void normalizeAngle(int *);
        void setXTranslation(int);
        void setYTranslation(int);
        void setZTranslation(int);

        float aspect;
        bool firstdraw;
        wxGLContext* MyContext;

        Point lastPosRot;
        int xRot;
        int yRot;
        int zRot;
        Point lastPosTrans;
        int xTrans;
        int yTrans;
        int zTrans;
        GLfloat light0_pos[4];
        GLfloat light0_color[4];

        unsigned int highlightOption;
        bool wireframeOption;
        bool controlPointsOption;


    DECLARE_EVENT_TABLE()
};

#endif
